import _Dialog from './index.vue'
import createDialog from './open-dialog'
import { App} from 'vue'
import { withInstall } from '@/util'
import { setGlobalProperty } from '@/util/global-properties'
import { DialogProps } from './dialog'

const Dialog = withInstall(_Dialog)

const createDialogPlugin = (app: App) => {
    return  (props:DialogProps) => {
        createDialog(app,props)
    }
}

const DialogInstall= (app)=> {
    // app.provide('OPENDIALOG', OpenDialog)
    setGlobalProperty(app, '$modal', createDialogPlugin(app))
}




export {
    Dialog as default,
    DialogInstall,
} 